home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / sourceaga / equalizer.s < prev    next >
Text File  |  1994-01-21  |  45KB  |  2,135 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. ;ocs            ;off=AGA,on=OCS, testing not possible on OCS !
  11.  
  12. routinemode    equ    300    ;the routinemode !
  13.  
  14.  
  15. ; VideoTracker AGA developer source 25-12-93
  16. ; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
  17. ; wich makes low-resolution overscan a bit ugly.
  18. ; no "interactive" support anymore, it's only used by Kick 1.3 users.
  19.  
  20. ; the first part of the source handles the things that are necessary to
  21. ; show the picture/copper and playing of the routine.
  22. ; the part between the "***" lines is the routine-source.
  23. ; at the bottom of the file, there are the necessary incbin-files who
  24. ; are needed to test the routine.
  25. ; these are saved with "save effect" in videotracker. they are raw
  26. ; data files which can be fonts,pictures,landscapes,vectorobjects
  27. ; etcetra.
  28. ; the incbin-files are put in the "variables" table, in the routine-
  29. ; player-handler
  30. ; the place where it's done can be found by searching for "!!!"
  31.  
  32.     opt    a+    ;devpac 3 optimize
  33.     opt    o+
  34.  
  35. vew_wid    equ    48
  36. vew_hgt    equ    290
  37. win_hgt    equ    117
  38. win_str    equ    $1a
  39.  
  40.         ifd    ocs
  41. pic_wid        equ    4        ;wide in bytes
  42. pic_hgt        equ    6        ;hoogte
  43. pic_dpt        equ    8        ;number planes
  44. pic_ani        equ    10        ;aantal effes (anim)
  45. pic_vew        equ    12        ;viewmode
  46. pic_cycstr    equ    14        ;cycle start (*4)
  47. pic_cycend    equ    15        ;cycle end (*4)
  48. pic_cycspd    equ    16        ;cycle speed (*4)
  49. pic_cycadd    equ    17        ;cycle add (*4)
  50. pic_palnum    equ    30        ;aantal kleuren
  51. pic_pal        equ    32        ;palette start
  52. pic_palsiz    equ    256*2        ;vaste palette size
  53. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  54.         endc
  55.         
  56.         ifnd    ocs
  57. pic_wid        equ    4        ;wide in bytes
  58. pic_hgt        equ    6        ;hoogte
  59. pic_dpt        equ    8        ;number planes
  60. pic_ani        equ    10        ;aantal effes (anim)
  61. pic_vew        equ    12        ;viewmode
  62. pic_cycstr    equ    14        ;cycle start (*8)
  63. pic_cycend    equ    15        ;cycle end (*8)
  64. pic_cycspd    equ    16        ;cycle speed (*8)
  65. pic_cycadd    equ    17        ;cycle add (*8)
  66. pic_widmod    equ    46        ;animation-width modulo
  67. pic_future    equ    50        ;free future space
  68. pic_palnum    equ    62        ;aantal kleuren
  69. pic_pal        equ    64        ;palette start
  70. pic_palsiz    equ    256*4        ;vaste palette size (longwords)
  71. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  72.         endc
  73.         
  74. var_len        equ    $300        ;lengte vartabel
  75.  
  76. var__GfxBase    equ    $000        ;graphics lib
  77. var_pic1    equ    $004        ;current picture
  78. var_anispd1    equ    $008        ;animspeed
  79. var_anitel1    equ    $00c        ;animcount
  80. var_cprbck    equ    $010        ;copperback
  81. var_bck        equ    $014        ;background
  82. var_pic2    equ    $018        ;current picture
  83. var_ntsc    equ    $01c        ;ntsc/pal frequence
  84. var_lnd        equ    $020        ;landscape
  85. var_anilop1    equ    $024
  86. var_rottrg    equ    $028        ;effect trigger
  87. var_txt1    equ    $040        ;text
  88. var_txt16    equ    15*4+var_txt1
  89. var_vec1    equ    $080        ;vectors
  90. var_vec16    equ    15*4+var_vec1
  91. var_fon1    equ    $0c0        ;fonts
  92. var_fon16    equ    15*4+var_fon1
  93. var_cols1    equ    $100        ;colorsets
  94. var_cols16    equ    15*4+var_cols1
  95. var_obj1    equ    $180        ;objects
  96. var_obj16    equ    15*4+var_obj1
  97.  
  98. var_audstr    equ    $1c0        ; start (*4) .l
  99. var_audlen    equ    $1c4        ; length (*4) .w
  100. var_audper    equ    $1c8        ; period (*4) .w
  101. var_audcnt    equ    $1cc        ; counter (*4) .w
  102. var_audlopstr    equ    $1d0        ; loop (*4) .w
  103. var_audreplen    equ    $1d4        ; loopstart (*4) .w
  104.  
  105. var_end        equ    $240
  106.  
  107.     ifd    rout
  108.     ;videotracker routine-test
  109.  
  110.     incdir    "videotracker:include/"
  111.     include    "exec/types.i"
  112.     include    "graphics/gfxbase.i"
  113.     include    "lvo/graphics_lib.i"
  114.     incdir    'videotracker:effect/'
  115.  
  116.     SECTION    1,CODE_C
  117. tus
  118. ;    move.l    #rotpt1,curpic1        ;picture !!!
  119. ;    move.l    #rotpt1,curpal1        ;picture !!!
  120.     bsr    paltabres
  121.     
  122.     move.l    ($4).w,a6
  123.     sub.l    a1,a1
  124.     jsr    -$126(a6)        ;findtask
  125.     move.l    d0,curtsk
  126.     move.l    d0,a0
  127.     move.l    $b8(a0),tskpri
  128.  
  129.     lea    dosnam,a1        ;doslib openen
  130.     moveq.l    #0,d0
  131.     move.l    (4).w,a6
  132.     jsr    -408(a6)        ;openlib
  133.     move.l    d0,doslib
  134.  
  135.     bsr.s    label5            ;videotracker opstarten
  136.     
  137.     move.l    curtsk,a0
  138.     move.l    tskpri,$b8(a0)
  139.     move.l    ($4).w,a6
  140.     jsr    -$84(a6)        ;forbid
  141.  
  142.     move.l    doslib,a1
  143.     move.l    (4).w,a6
  144.     jsr    -414(a6)        ;closelib
  145.  
  146.     moveq.l    #0,d0
  147.     rts
  148.     
  149. label5
  150.     move.l    (4).w,a6        ;workbench gedoe
  151.  
  152.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  153.  
  154.     ifd    ntsctest
  155.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  156.     endc
  157.  
  158.     cmp.b    #50,ntscmode        ;ntsc ?
  159.     beq.s    str.ntsc
  160.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  161. str.ntsc
  162.  
  163.     lea    cprjmp,a2        ;copjmp zetten !
  164.     move.l    #cprbck-8,d0
  165.     move.w    d0,6(a2)
  166.     swap    d0
  167.     move.w    d0,2(a2)
  168.  
  169.     lea    cprbck-8,a2        ;copstr zetten !
  170.     move.l    #cpr,d0
  171.     move.w    d0,6(a2)
  172.     swap    d0
  173.     move.w    d0,2(a2)
  174.  
  175.     bsr    cprsprrem        ;sprites legen
  176.  
  177.     lea    gfxnam,a1        ;graphics lib openen
  178.     move.l    (4).w,a6
  179.     jsr    -408(a6)        ;openlib
  180.     move.l    d0,a6
  181.     move.l    d0,gfxlib
  182.     move.l    38(a6),oldcprlist
  183.  
  184.     bset    #1,$bfe001
  185.     bsr    copbuf            ;copper vullen
  186.  
  187.     bsr    sysoff
  188.  
  189. gadrun
  190.     btst    #6,($bfe001).l
  191.     bne    gadrun
  192.  
  193. scrend
  194. scrend.play
  195.     bsr    syson
  196.  
  197.     move.l    gfxlib,a1
  198.     move.l    (4).w,a6
  199.     jsr    -414(a6)        ;closelib
  200.  
  201. scrend.qb
  202.     moveq.l    #0,d0    
  203.     rts
  204.     
  205.     ;vertical blank interrupt, no blits.
  206.     ;handles counters,interlace,sprite
  207.     ;level 3
  208.  
  209. intvb
  210.     bra.s    intvb.cnt
  211.     dc.l    'VIDU'
  212.     dc.l    'LOOP'
  213. intvb.cnt
  214.     movem.l    d0-d7/a0-a6,-(sp)
  215.     lea    ($dff000).l,a6
  216.  
  217.     move.w    $01e(a6),d0
  218.     btst    #5,d0            ;vblank ?
  219.     bne.s    intvb.vb
  220.  
  221.     bra.s    intcop.end
  222.  
  223. intvb.vb
  224.     bsr    grap
  225.     bsr    palctr            ;palette zetten
  226.     bsr.s    copbuf            ;copper vullen
  227.     
  228. intvb.end
  229.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  230.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  231.     rte
  232.  
  233. intcop.end
  234.     movem.l    (sp)+,d0-d7/a0-a6
  235.     move.l    intvbold,-(sp)
  236.     rts
  237.  
  238.     ;transmission buffer empty routine, BLIT !
  239.     ;handles routines,animations
  240.     
  241. inttbe                    ;tbe interrupt
  242.     movem.l    d0-d7/a0-a6,-(sp)
  243.     lea    ($dff000).l,a6
  244.  
  245.     move.w    $01e(a6),d0
  246.     btst    #0,d0            ;no tbe ?
  247.     beq.s    intdskblk
  248.  
  249.  
  250.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  251.     beq.s    inttbe.cop
  252.     btst    #2,($dff016).l
  253.     beq.s    inttbe.cop
  254.  
  255.     ifd    debug
  256.     move.w    #$700,$dff180
  257.     endc
  258.     
  259.     bsr    rotply            ;routineplayer BLIT !
  260.     bsr.s    copbuf            ;copper vullen
  261.  
  262.     ifd    debug
  263.     move.w    #$070,$dff180
  264.     endc
  265.     
  266. inttbe.cop
  267.  
  268. inttbe.end
  269.     move.w    #$0001,$09c(a6)
  270.     movem.l    (sp)+,d0-d7/a0-a6
  271.     rte
  272.  
  273. intdskblk
  274.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  275.     movem.l    (sp)+,d0-d7/a0-a6
  276.     move.l    inttbeold,-(sp)
  277.     rts
  278.  
  279.  
  280.     ;moves the copperbuffer to the copperlist
  281.     ;sort of double buffering
  282.     
  283. copbuf
  284.     movem.l    d0-d7/a0-a6,-(sp)
  285.  
  286.     lea    ($dff000).l,a6
  287.  
  288. copbuf.novb                ;copperchange overslaan
  289.     moveq.l    #0,d0
  290.     move.b    $005(a6),d0
  291.     lsl.w    #8,d0
  292.     moveq.l    #0,d1
  293.     move.b    $006(a6),d1
  294.     add.w    d1,d0
  295.  
  296.     cmp.w    #$4,d0            ;lower limit, all stations 100%
  297.     blt    copbuf.novb
  298.  
  299.     cmp.b    #50,ntscmode
  300.     beq.s    copbuf.pal
  301.     cmp.w    #$133-72-8,d0        ;ntsc grens
  302.     bge    copbuf.novb
  303.     bra.s    copbuf.cont
  304. copbuf.pal
  305.     cmp.w    #$133-8,d0        ;pal grens
  306.     bge    copbuf.novb
  307. copbuf.cont
  308.  
  309.     lea    gra.s,a0        ;buffer copieren
  310.     lea    cprbuf,a1
  311. copbuf_aga                ;AGA stuff :)
  312.     move.l    #(gra.ql)/4-1,d0
  313. copbuf.a
  314.     move.w    2(a0),2(a1)
  315.     add.l    #4,a0
  316.     add.l    #4,a1
  317.     dbra    d0,copbuf.a
  318.  
  319. copbuf.end
  320.     movem.l    (sp)+,d0-d7/a0-a6
  321.     rts
  322.  
  323.     ;goes back to the workbench
  324.     
  325. syson
  326.     movem.l    d0-d7/a0-a6,-(sp)
  327.  
  328.     move.w    #$0001,$dff09a        ;tbeint uit
  329.     move.l    intvbold,($6c).w
  330.     move.l    inttbeold,($64).w
  331.  
  332.     move.l    4,a6
  333.     jsr    -138(a6)        ;permit
  334.  
  335.     move.l    gfxlib,a6
  336.     jsr    -462(a6)        ;disownblitter
  337.  
  338.     move.l    wbview,a1
  339.     move.l    gfxlib,a6
  340.     jsr    _LVOLoadView(a6)     ; Fix view
  341.     jsr    _LVOWaitTOF(a6)
  342.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  343.  
  344. syson.ras
  345.     cmp.b    #$c0,$dff006        ;prevent copperjump
  346.     bne    syson.ras
  347.  
  348.     move.l    gfxlib,a6
  349.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  350.  
  351.     movem.l    (sp)+,d0-d7/a0-a6
  352.     rts
  353.     
  354.     ;goes back to the gadgetscreen
  355.     
  356. sysoff
  357.     movem.l    d0-d7/a0-a6,-(sp)
  358.      
  359.     move.l    gfxlib,a6
  360.     move.l    gb_ActiView(a6),wbview    ;current view
  361.     sub.l    a1,a1            ; clear a1
  362.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  363.     jsr    _LVOWaitTOF(a6)     ; Wait once
  364.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  365.  
  366.     move.l    gfxlib,a6
  367.     jsr    -456(a6)        ;ownblitter
  368.  
  369.     move.l    4,a6
  370.     jsr    -132(a6)        ;forbid
  371.         
  372.     move.l    ($6c).w,intvbold
  373.     move.l    #intvb,($6c).w
  374.     move.l    ($64).w,inttbeold
  375.     move.l    #inttbe,($64).w
  376.     move.w    #$8001,$dff09a        ;tbeint aan
  377.     bsr    gracpr            ;reset copper
  378.     bsr    copbuf            ;copy copper
  379.     move.l    #cpr,$dff080
  380.  
  381.     movem.l    (sp)+,d0-d7/a0-a6
  382.     rts
  383.     
  384. cprsprrem
  385.     movem.l    d0-d7/a0-a6,-(sp)
  386.     lea    cprspr,a0
  387.     move.l    #sprdat,d0
  388.     move.w    #7,d1
  389. cprsprrem.a
  390.     move.w    d0,3*2(a0)
  391.     swap    d0
  392.     move.w    d0,1*2(a0)
  393.     swap    d0
  394.     add.l    #8,a0
  395.     dbra    d1,cprsprrem.a
  396.     movem.l    (sp)+,d0-d7/a0-a6
  397.     rts
  398.  
  399. varset                    ;variablen neerzetten
  400.     movem.l    d0-d7/a0-a6,-(sp)
  401.     move.l    #var,a0
  402.  
  403.     mo